<template>
  <div class="hm-login">
    <div class="title">面经登录</div>
    <div class="user">
      <span class="user-left">用户名</span>
      <input
        type="text"
        placeholder="用户名"
        class="user-right"
        v-model="user"
      />
    </div>
    <div class="password">
      <span class="password-left">密码</span>
      <input
        type="password"
        placeholder="密码"
        class="password-right"
        v-model="password"
      />
    </div>
    <van-button type="primary" size="large" color="#fa6d1d" @click="login"
      >提交</van-button
    >
    <div class="reg">
      <router-link to="/register" class="registered">注册账号</router-link>
    </div>
  </div>
</template>

<script>
//导入UserRequest
import { UserRequest } from "@/api/user.js";
export default {
  name: "HmLogin",
  data() {
    return {
      user: "zhengcy",
      password: "zcy123456",
      data: {},
    };
  },
  methods: {
    login() {
      //调用UserRequest中的UserLogin方法
      UserRequest.UserLogin({
        user: this.user,
        password: this.password,
      });
    },
  },
  created() {
    this.data = this.$route.query.data;
  },
};
</script>

<style scoped lang="less">
.hm-login {
  padding: 10px;
  .title {
    font-size: (20 / @vw);
    text-align: center;
    margin-bottom: (10 / @vw);
  }
  .user {
    height: (44 / @vw);
    display: flex;
    align-items: center;
    font-size: (16 / @vw);
    //上下边框 实线 1px 颜色#ccc
    border-bottom: 1px solid #ccc;
    border-top: 1px solid #ccc;
    .user-left {
      width: (86 / @vw);
      height: (24 / @vw);
      color: #999;
    }
    .user-right {
      border: none;
      height: (24 / @vw);
    }
    .user-right::placeholder {
      font-size: (14 / @vw);
      color: #ccc;
    }
  }
  .password {
    height: (44 / @vw);
    display: flex;
    align-items: center;
    font-size: (16 / @vw);
    //上下边框 实线 1px 颜色#ccc
    border-bottom: 1px solid #ccc;
    margin-bottom: (10 / @vw);
    .password-left {
      width: (86 / @vw);
      height: (24 / @vw);
      color: #999;
    }
    .password-right {
      border: none;
      height: (24 / @vw);
    }
    .password-right::placeholder {
      font-size: (14 / @vw);
      color: #ccc;
    }
  }
  .reg {
    display: flex;
    justify-content: right;
    margin-top: (20 / @vw);
    .registered {
      font-size: (14 / @vw);
      text-decoration: none;
    }
  }
}
</style>
